package dto

import (
	"go-admin/app/hunter/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
)

type HtProjectGetPageReq struct {
	dto.Pagination `search:"-"`
	Name           string `form:"name"  search:"type:contains;column:name;table:ht_project" comment:"项目名称"`
	Note           string `form:"note"  search:"type:exact;column:note;table:ht_project" comment:"备注"`
	Status         string `form:"status"  search:"type:exact;column:status;table:ht_project" comment:"状态"`
	HtProjectOrder
}

type HtProjectOrder struct {
	Id        string `form:"idOrder"  search:"type:order;column:id;table:ht_project"`
	Name      string `form:"nameOrder"  search:"type:order;column:name;table:ht_project"`
	Note      string `form:"noteOrder"  search:"type:order;column:note;table:ht_project"`
	Status    string `form:"statusOrder"  search:"type:order;column:status;table:ht_project"`
	CreateBy  string `form:"createByOrder"  search:"type:order;column:create_by;table:ht_project"`
	UpdateBy  string `form:"updateByOrder"  search:"type:order;column:update_by;table:ht_project"`
	CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:ht_project"`
	UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:ht_project"`
	DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:ht_project"`
}

func (m *HtProjectGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type HtProjectInsertReq struct {
	Id     int    `json:"-" comment:"项目id"` // 项目id
	Name   string `json:"name" comment:"项目名称"`
	Note   string `json:"note" comment:"备注"`
	Status string `json:"status" comment:"状态"`
	common.ControlBy
}

func (s *HtProjectInsertReq) Generate(model *models.HtProject) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Name = s.Name
	model.Note = s.Note
	model.Status = s.Status
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

func (s *HtProjectInsertReq) GetId() interface{} {
	return s.Id
}

type HtProjectUpdateReq struct {
	Id     int    `uri:"id" comment:"项目id"` // 项目id
	Name   string `json:"name" comment:"项目名称"`
	Note   string `json:"note" comment:"备注"`
	Status string `json:"status" comment:"状态"`
	common.ControlBy
}

func (s *HtProjectUpdateReq) Generate(model *models.HtProject) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Name = s.Name
	model.Note = s.Note
	model.Status = s.Status
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

func (s *HtProjectUpdateReq) GetId() interface{} {
	return s.Id
}

// HtProjectGetReq 功能获取请求参数
type HtProjectGetReq struct {
	Id int `uri:"id"`
}

func (s *HtProjectGetReq) GetId() interface{} {
	return s.Id
}

// HtProjectDeleteReq 功能删除请求参数
type HtProjectDeleteReq struct {
	Ids []int `json:"ids"`
}

// HtProjectTalentDeleteReq 功能删除请求参数
type HtProjectTalentDeleteReq struct {
	ProjectId int   `json:"projectId"`
	Ids       []int `json:"ids"`
}

// HtProjectTalentBindReq 功能删除请求参数
type HtProjectTalentBindReq struct {
	ProjectId int   `json:"projectId"`
	Ids       []int `json:"ids"`
}

func (s *HtProjectDeleteReq) GetId() interface{} {
	return s.Ids
}

type ProjectLabel struct {
	Id       int            `gorm:"-" json:"id"`
	Label    string         `gorm:"-" json:"label"`
	Children []ProjectLabel `gorm:"-" json:"children"`
}
